/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ExcelAccess;

import java.io.File;

/**
 *
 * @author User
 */
public class AllocateFile {
    public static File GetFile(String fileName,String fileExtension, File parentDir){
        if(!parentDir.exists()){
            parentDir.mkdir();
        }
        File newFile = new File(parentDir.getAbsolutePath() + "/" + fileName + fileExtension);
        int i = 0;
        while(newFile.exists() && i < 10000){
            newFile = new File(parentDir.getAbsolutePath() + "/" + fileName + i + fileExtension);
            i++;
        }
        return newFile;
    }
}
